package vista;
import java.awt.BorderLayout;
import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.SpinnerListModel;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import controlador.ContActualizarProductos;
import controlador.ContOrden;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class DlgOrden extends javax.swing.JDialog {
	private JPanel PnlOrden;
	private JLabel lblCliente;
	private JScrollPane jScrollPane1;
	private JLabel lblSubtotal;
	private JButton btSalir;
	private JButton btAceptar;
	private JButton btQuitar;
	private JButton btAnadir;
	private JLabel lblProductos;
	private JTable tblProductos;
	private JTextField txtCliente;

	/**
	* Auto-generated main method to display this JDialog
	*/
	private ContOrden controlador;

	public DlgOrden(JFrame frame, ContOrden controlador) {
		super(frame);
		this.controlador = controlador;
		initGUI();
	}
	
	private void initGUI() {
		try {
			{
				this.setTitle("Orden");
				BorderLayout thisLayout = new BorderLayout();
				getContentPane().setLayout(thisLayout);
				{
					PnlOrden = new JPanel();
					getContentPane().add(PnlOrden, BorderLayout.CENTER);
					//PnlOrden.setLayout(PnlOrdenLayout);
					PnlOrden.setLayout(null);
					PnlOrden.setPreferredSize(new java.awt.Dimension(408, 311));
					{
						lblCliente = new JLabel();
						PnlOrden.add(lblCliente);
						lblCliente.setText("Cliente:");
						lblCliente.setBounds(40, 25, 47, 14);
					}
					{
						txtCliente = new JTextField();
						PnlOrden.add(txtCliente);
						txtCliente.setBounds(105, 22, 175, 21);
					}
					{
						lblProductos = new JLabel();
						PnlOrden.add(lblProductos);
						lblProductos.setText("Productos");
						lblProductos.setBounds(156, 63, 72, 14);
					}
					{
						jScrollPane1 = new JScrollPane();
						PnlOrden.add(jScrollPane1);
						jScrollPane1.setBounds(12, 89, 384, 100);
						{
							tblProductos = new JTable();
							jScrollPane1.setViewportView(tblProductos);
							tblProductos.setBounds(12, 83, 381, 78);
						}
					}
					{
						btAnadir = new JButton();
						PnlOrden.add(btAnadir);
						btAnadir.setText("Agregar");
						btAnadir.setBounds(110, 195, 81, 21);
					}
					{
						btQuitar = new JButton();
						PnlOrden.add(btQuitar);
						btQuitar.setText("Quitar");
						btQuitar.setBounds(211, 195, 75, 21);
					}
					{
						btAceptar = new JButton();
						PnlOrden.add(btAceptar);
						btAceptar.setText("Aceptar");
						btAceptar.setBounds(216, 273, 86, 26);
					}
					{
						btSalir = new JButton();
						PnlOrden.add(btSalir);
						btSalir.setText("Salir");
						btSalir.setBounds(326, 273, 63, 26);
					}
					{
						lblSubtotal = new JLabel();
						PnlOrden.add(lblSubtotal);
						lblSubtotal.setText("Subtotal: 0.00");
						lblSubtotal.setBounds(40, 238, 311, 14);
					}
				}
			}
			this.setSize(418, 345);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public JTable getTblProductos() {
		return tblProductos;
	}
	
	public void setTxtCliente(String nombre) {
		txtCliente.setText(nombre);
	}
	
	public String getTxtCliente() {
		return txtCliente.getText();
	}

	
	public JButton getBtAnadir() {
		return btAnadir;
	}
	
	public JButton getBtQuitar() {
		return btQuitar;
	}

	public JButton getBtAceptar() {
		return btAceptar;
	}

	public JButton getBtSalir() {
		return btSalir;
	}
	
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}

	public JLabel getLblSubtotal() {
		return lblSubtotal;
	}
}
